package cn.codergege.dp01.controller;

import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import cn.codergege.dp01.model.Department;
import cn.codergege.dp01.service.DepartmentService;

@Controller
@RequestMapping("/springmvc")
public class TestController {
	private Logger log = LoggerFactory.getLogger(TestController.class);
	
	@Autowired
	private DepartmentService departmentService;
	
	@RequestMapping("/test")
	public String test(Map<String, Object> map) {

		Department department = departmentService.getOne(1);
		map.put("department", department);
		
		log.info(department.toString());
		
		return "forward:/test.jsp";
	}

}
